package com.saris.primego.dao;

import com.saris.primego.pojo.entity.Orders;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@Repository
public interface OrderRepository extends JpaRepository<Orders, Long> , JpaSpecificationExecutor<Orders> {
    List<Orders> getAllByStatus(Integer status);

    List<Orders> getByNumberAndUserId(String number, Long userId);

    List<Orders> findAllByStatus(Integer status);

    List<Orders> findAllByOrderTimeBetweenAndStatus(LocalDateTime orderTimeAfter, LocalDateTime orderTimeBefore, Integer status);

    Long countByOrderTimeBetweenAndStatus(LocalDateTime orderTimeAfter, LocalDateTime orderTimeBefore, Integer status);

    Long countByStatus(Integer status);

    long countByOrderTimeAfterAndStatus(LocalDateTime orderTimeAfter, Integer status);
}
